<?php
/**
 * 文档注释
 */
/**
 * 获取连接对象
 */ 


function getConn() {
    $url = "localhost:3306";
    $user = "root";
    $password = "";// 如果没有密码, 就是空字符串
    $database = "shop";
    $conn = mysqli_connect($url, $user, $password, $database);
    mysqli_query($conn, "set names utf8");
    return $conn;
}


function update($sql){
    $conn=getConn();
    $result=mysqli_query($conn,$sql);
    return $result;
}

function query($sql){
    $conn=getConn();
    $result=mysqli_query($conn,$sql);
    $list=[];
    while($row=mysqli_fetch_assoc($result)){
        $list[]=$row;
    }
    return $list;
}
?>